package com.sxzt.core.test;

import com.sxzt.core.enum_status.BaseOut;
import com.sxzt.core.enum_status.DefaultBusinessStatus;
import com.sxzt.core.result.DefaultResult;

public class CustomResponseUtil<T> extends DefaultResult<T> {

    @Override
    public CustomResponseConcreteBuilder<T> getBuilder(BaseOut baseOut) {
        return new CustomResponseConcreteBuilder<>(baseOut);
    }

    @Override
    public CustomResponse<T> makeResult(BaseOut baseOut, T data) {
        return (CustomResponse<T>) super.makeResult(baseOut, data);
    }

    @Override
    public CustomResponse<T> success() {
        return makeResult(DefaultBusinessStatus.SUCCESS, null);
    }

    @Override
    public CustomResponse<T> error() {
        return makeResult(DefaultBusinessStatus.ERROR, null);
    }


    //自定义扩展字段
    public CustomResponse<T> customOk(String html) {
        return makeResult(DefaultBusinessStatus.SUCCESS, null).setHtml(html);
    }
}
